package singleton;

/**
 * 懒汉式，线程安全
 *
 * @author 若雨成霜
 */
public class SingletonType2 {


    private static SingletonType2 instance2 = null;

    private SingletonType2() {
    }

    public static synchronized SingletonType2 getInstance() {
        if (instance2 == null) {
            instance2 = new SingletonType2();
        }
        return instance2;
    }
}
